//package com.yzf.enterprise.framework.config.shardingjdbc;
//
//
//import io.shardingsphere.api.algorithm.sharding.PreciseShardingValue;
//import io.shardingsphere.api.algorithm.sharding.standard.PreciseShardingAlgorithm;
//import lombok.extern.slf4j.Slf4j;
//
//import java.util.Collection;
//
///**
// * 数据库分库的策略，根据分片键，返回数据库名称
// */
//@Slf4j
//public class DBPreShardAlgo implements PreciseShardingAlgorithm<Long> {
//    @Override
//    public String doSharding(Collection<String> collection, PreciseShardingValue<Long> preciseShardingValue) {
//        String db_name = "monitor";
//        Long num = preciseShardingValue.getValue() % collection.size();
//        db_name = db_name + num;
//        log.info("sharding value is " + preciseShardingValue.getValue() + ", db name is " + db_name);
//        for (String each : collection) {
//            if (each.equals(db_name)) {
//                return each;
//            }
//        }
//        throw new IllegalArgumentException();
//    }
//
//}
